Persist OCI manifest content model per image digest - #455
Conversation
8255d11 to
1f79ed8
Compare
-->
✱ stlc build✅ go code · compare
✅ python code · compare
✅ typescript code · compare
Diagnostics: ❗ 0 new / 1 total error, 💡 0 new / 5 total note
Build metadata
This comment is auto-generated by stlc and is kept up to date as you push. |
1d3b38c to
e6fdc4c
Compare
345e8e0 to
07373a3
Compare
07373a3 to
e8971b4
Compare
e8971b4 to
4639430
Compare
4639430 to
273909b
Compare
31c4161 to
c6dcc2c
Compare
c6dcc2c to
cc7944c
Compare
b42b87c to
50bee89
Compare
b992e00 to
76c7b91
Compare
76c7b91 to
5b0a0df
Compare
5b0a0df to
dd879d9
Compare
b2941b0 to
a6e571e
Compare
sjmiller609
left a comment
There was a problem hiding this comment.
1. secondary tag stays stale
starting state
# stable currently resolves to digest A
kernel images create app:stable
# registry updates latest and stable to digest B
docker tag app@sha256:B app:latest
docker tag app@sha256:B app:stable
docker push app:latest
docker push app:stable
# start pulling B through latest
kernel images create app:latestaction
kernel images create app:stableexpected: both tags move to B.
actual: only latest moves; stable remains on A.
2. resource labels are ignored
starting state
kernel images create app:latest --tag team=platform
kernel images wait app:latestaction
kernel images create app:latest --tag team=paymentsexpected: app:latest reports team=payments.
actual: the reused image retains team=platform.
3. readiness returns too early
starting state
# A is ready
kernel images create app@sha256:A
kernel images tag app@sha256:A app:latest
# start B, then a newer C
kernel images create app@sha256:B --as app:latest
kernel images create app@sha256:C --as app:latest
# C subsequently fails; B remains in progressaction
kernel images wait app:latestexpected: wait for B.
actual: immediately succeeds using old ready image A.
4. eager migration potentially risky
If the migration fails for some reason, it's stuck in image not ready until content/A is manually removed.
Consider a no-op migration instead: leave existing images in the legacy layout, use the shared format only for new images, support reads from both layouts, and add lazy migration only when a future feature requires manifest.json.
|
bugs addressed + found 1 more, re-running CI now |
summary
This PR does three things
images/content/<digest>/manifest.jsonStacked stage of the image-storage project. Persists one content model document per image digest at
images/content/<digest>/manifest.json:rootfs.diff_idsblobReferences()accessor listing config + layer digests for future GCwhy
Stages 4/5 need the ordered layer list and diff ids to materialize per-layer artifacts and recompose rootfs without re-reading registries; GC needs to know which OCI cache blobs each ready image still references. Extracted from the existing OCI layout cache during the pull's metadata phase — no second blob downloader.
details
extractManifestModelreads manifest + config from the shared layout cache (system/oci-cache), reusing already-downloaded blobs.finalizeImagebeside the shared content; legacy images simply have no model (read returns nil).writeJSONAtomic).flow change
The change moves tag state from persisted per-reference metadata to one persisted pull claim plus in-memory indexes.
pre-existing flow
new flow
startup and readiness waits
The new
manifest.jsonrecords the config digest, ordered layer digests, diff IDs, platform, and media types.blobReferences()exposes the config and layer digests for later garbage collection without rereading the registry.validation
go test ./lib/images ./lib/paths -count=1— new tests cover synthetic two-layer layouts (ordering, digest/diff-id pairing, platform), write/read roundtrip atomicity, missing-model reads, blob references, and an end-to-end import that lands a ready image with a correct model.Note
Low Risk
Additive on-disk metadata on the image finalize path; no auth or API behavior changes, and missing models are handled for legacy images.
Overview
Adds a persisted OCI manifest content model at
images/content/<digest>/manifest.jsonfor each image that finishes the pull/build pipeline. The document captures manifest identity, platform, config blob digest with ordereddiff_ids, and ordered layer descriptors (compressed digest, size, media type) so later work can rebuild rootfs from per-layer artifacts and GC can see which OCI cache blobs are still referenced viablobReferences().During pull,
extractManifestModelbuilds this structure from the shared OCI layout cache in the same metadata phase as existing inspection—no extra registry downloads.finalizeImagewrites the model atomically next to shared content and overwrites platform with the resolved manifest platform. Images converted before this change simply have no file;readManifestModelreturns nil without error.Metadata JSON writes now share
writeJSONAtomic(temp file + rename), including manifest persistence.Reviewed by Cursor Bugbot for commit 752a6d8. Configure here.